package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpContractsListPageUtil extends SeleniumPageUtil{
	public final static By CTL_SPAN_HEAD_TITLE	 	= By.id("ctl44_ContractsReport_Header_lblHeader");
	public final static By CTL_IMG_PREFER					= By.id("ctl44_ContractsReport_Header_imgPreferences");
	public final static By CTL_IMG_EXPORT 				= By.id("ctl44_ContractsReport_Header_imgExcelExport");
	public final static By CTL_TD_PAGE 					= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[1]");
	public final static By CTL_TD_CURR_PAGE_NUM 	= By.id("ctl44_ContractsReport_PagingTop_lblPagingPageNumber");
	public final static By CTL_TD_OF 						= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[3]");
	public final static By CTL_IMG_PAGE_FIRST			= By.id("ctl44_ContractsReport_PagingTop_imgFirst");
	public final static By CTL_IMG_PAGE_PREVIOUS	= By.id("ctl44_ContractsReport_PagingTop_imgPrevious");
	public final static By CTL_IMG_PAGE_NEXT			= By.id("ctl44_ContractsReport_PagingTop_imgNext");
	public final static By CTL_IMG_PAGE_LAST			= By.id("ctl44_ContractsReport_PagingTop_imgLast");
	
	public final static By CTL_FILTER_CONTRACT_ID		= By.id("ctl44_ContractsReport_filter_0");
	public final static By CTL_FILTER_COSTOMER		= By.id("ctl44_ContractsReport_filter_1");
	public final static By CTL_FILTER_CYCLE		= By.id("ctl44_ContractsReport_filter_2");
	public final static By CTL_FILTER_STATUC		= By.id("ctl44_ContractsReport_filter_3");
	public final static By CTL_FILTER_DESC		= By.id("ctl44_ContractsReport_filter_4");
	public final static By CTL_FILTER_START_DATE		= By.id("ctl44_ContractsReport_filter_5");
	public final static By CTL_FILTER_END_DATE		= By.id("ctl44_ContractsReport_filter_6");
	public final static By CTL_FILTER_SUPPLIER		= By.id("ctl44_ContractsReport_filter_7");
	public final static By CTL_FILTER_SUPP_SERVICE		= By.id("ctl44_ContractsReport_filter_8");
	public final static By CTL_FILTER_DISCOUNT		= By.id("ctl44_ContractsReport_filter_10");
	
	public final static By CTL_TD_CONTRACT_ID		= By.id("ctl44_ContractsReport_sort_0");
	public final static By CTL_TD_COSTOMER			= By.id("ctl44_ContractsReport_sort_1");
	public final static By CTL_TD_CYCLE					= By.id("ctl44_ContractsReport_sort_2");
	public final static By CTL_TD_STATUC					= By.id("ctl44_ContractsReport_sort_3");
	public final static By CTL_TD_DESC						= By.id("ctl44_ContractsReport_sort_4");
	public final static By CTL_TD_START_DATE			= By.id("ctl44_ContractsReport_sort_5");
	public final static By CTL_TD_END_DATE				= By.id("ctl44_ContractsReport_sort_6");
	public final static By CTL_TD_SUPPLIER				= By.id("ctl44_ContractsReport_sort_7");
	public final static By CTL_TD_SUPP_SERVICE			= By.id("ctl44_ContractsReport_sort_8");
	public final static By CTL_TD_DISCOUNT				= By.id("ctl44_ContractsReport_sort_10");
	
	public static void enter(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterContractsList();
		waitForPageToLoad();
	}

	private static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				CTL_TD_CONTRACT_ID,CTL_TD_DISCOUNT
		});
	}
}
